package com.heima.feigns;

import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @package com.heima.feigns
 * @Date 2022/2/27
 * @project heima-leadnews
 */
@FeignClient(
        value = "leadnews-article",
        configuration = HeimaFeignAutoConfiguration.class,
        fallbackFactory = ArticleFeignFallback.class
)
public interface ArticleFeign {
    @PostMapping("/api/v1/author/save")
    public ResponseResult<ApAuthor> insertWmUser(@RequestBody ApAuthor apAuthor);
    @ApiOperation("根据名称查询")
    @GetMapping("/api/v1/author/findByUserId/{userId}")
    public ResponseResult<ApAuthor>  selectById(@PathVariable("userId") Integer userId);
    @PostMapping("/api/v1/article/findOne")
    public ResponseResult<ApArticle> findOne(@RequestBody Long id);
}
